import datetime


# 获取当前日期
today = datetime.date.today()

# 获取今天是星期几
weekday = today.weekday()
weekdays = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
wee = weekdays[weekday]
print(f"今天是：{wee}")

# 计算距离本年结束还有多少天
year_end = datetime.date(today.year, 12, 31)
# 如果今天已经是今年的最后一天，则返回0
if today == year_end:
    days_left = 0
else:
    days_left = (year_end - today).days
print(f"距离本年结束还有：{days_left}天")

# 计算距离周末还有多少天
if weekday <= 4:  # 如果今天是周一到周五
    days_until_weekend = 5 - weekday
else:  # 如果今天是周六或周日
    days_until_weekend = 13 - weekday
print(f"距离周末还有：{days_until_weekend}天")

# 计算距离元旦还有多少天
new_year = datetime.date(today.year + 1, 1, 1)
days_until_new_year = (new_year - today).days
print(f"距离元旦还有：{days_until_new_year}天")

# 计算距离春节还有多少天
# 注意：这里使用了一个简单的计算方法，实际应用中可能需要更精确的农历计算
chinese_new_year = datetime.date(today.year, 1, 1)
if today > chinese_new_year:
    chinese_new_year = datetime.date(today.year + 1, 1, 1)
days_until_chinese_new_year = (chinese_new_year - today).days
print(f"距离春节还有：{days_until_chinese_new_year}天")

# 计算距离清明节还有多少天
qingming = datetime.date(today.year, 4, 4)
if today > qingming:
    qingming = datetime.date(today.year + 1, 4, 4)
days_until_qingming = (qingming - today).days
print(f"距离清明节还有：{days_until_qingming}天")

# 计算距离劳动节还有多少天
labour_day = datetime.date(today.year, 5, 1)
if today > labour_day:
    labour_day = datetime.date(today.year + 1, 5, 1)
days_until_labour_day = (labour_day - today).days
print(f"距离劳动节还有：{days_until_labour_day}天")

# 计算距离端午节还有多少天
dragon_boat_festival = datetime.date(today.year, 6, 12)
if today > dragon_boat_festival:
    dragon_boat_festival = datetime.date(today.year + 1, 6, 12)
days_until_dragon_boat_festival = (dragon_boat_festival - today).days
print(f"距离端午节还有：{days_until_dragon_boat_festival}天")

# 计算距离中秋节还有多少天
mid_autumn_festival = datetime.date(today.year, 9, 9)
if today > mid_autumn_festival:
    mid_autumn_festival = datetime.date(today.year + 1, 9, 9)
days_until_mid_autumn_festival = (mid_autumn_festival - today).days
print(f"距离中秋节还有：{days_until_mid_autumn_festival}天")

# 计算距离国庆节还有多少天
national_day = datetime.date(today.year, 10, 1)
if today > national_day:
    national_day = datetime.date(today.year + 1, 10, 1)
days_until_national_day = (national_day - today).days
print(f"距离国庆节还有：{days_until_national_day}天")


